package com.hirisun.faces.components;

import java.io.Serializable;

import javax.faces.component.html.HtmlInputText;
import javax.faces.context.FacesContext;

public class ProcessInputText extends HtmlInputText implements IProcessInput {

	static public final String COMPONENT_TYPE = "com.hirisun.faces.HtmlInputText";

	private String pv;
	private State state;

	public String getPv() {
		return pv;
	}

	public void setPv(String pv) {
		this.pv = pv;
	}

	@Override
	public void restoreState(FacesContext facesContext, Object object) {
		State state = (State) object;
		super.restoreState(facesContext, state.superState);
		pv = state.pv;
	}

	@Override
	public Object saveState(FacesContext facesContext) {
		if (state == null) {
			state = new State();
		}
		state.superState = super.saveState(facesContext);
		state.pv = pv;
		return state;
	}

	private static final class State implements Serializable {
		private static final long serialVersionUID = 1L;
		public Object superState;
		public String pv;
	}
}
